﻿using SimpleNet.Net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets;
using System.Reflection.Emit;
using System.Text;
using System.Threading.Tasks;

/*********************************************************
 * 命名空间 Simple.BasicNet.Core.Handle
 * 接口名称 IContext
 * 开发人员：11920
 * 创建时间：2023/4/12 9:25:50
 * 描述说明：
 * 更改历史：
 * 
 * *******************************************************/
namespace SimpleNet.Handle
{
	public interface IContext
	{
		public IDataPack CurrentPack { get; set; }
		public long ConnectionId { get; set; }
		public void Send(byte[] bytes);

		public  Task SendAsync(byte[] buffer, SocketFlags socketFlags, CancellationToken cancellationToken = default);
		public void SendUTF8(string msg);


		public Task SendUTF8Async(string msg, SocketFlags socketFlags, CancellationToken cancellationToken = default);
		public void SendASCII(string msg);

		public  Task SendASCIIAsync(string msg, SocketFlags socketFlags, CancellationToken cancellationToken = default);

		public void SetClient(Socket socket);
		public TContext GetContext<TContext>() where TContext : class, IContext;
	}
}
